// created Jan 28, 2009 4:14:45 PM
// by petrovic

package org.taglets.pub.tags;

import java.net.HttpURLConnection;
import java.util.logging.Logger;

import org.taglets.exception.AuthenticationFailedException;
import org.taglets.exception.NotAuthorizedException;
import org.taglets.exception.RateLimitExceededException;
import org.taglets.exception.ServerErrorException;
import org.taglets.exception.TagNotFoundException;
import org.taglets.pub.AppResponse;
import org.taglets.pub.HttpResponse;

public final class TagUpdateResponse extends AppResponse {
    @SuppressWarnings("unused")
    private static Logger LOG = Logger.getLogger(TagUpdateResponse.class.getName());

    public TagUpdateResponse(HttpResponse httpResponse) throws AuthenticationFailedException, TagNotFoundException, NotAuthorizedException, RateLimitExceededException, ServerErrorException {
        super(httpResponse);
        if (responseCode == HttpURLConnection.HTTP_CREATED) {
            succeeded = true;
        } else if (responseCode == HttpURLConnection.HTTP_PRECON_FAILED) {
            throw new AuthenticationFailedException();
        } else if (responseCode == HttpURLConnection.HTTP_NOT_FOUND) {
            throw new TagNotFoundException();
        } else if (responseCode == HttpURLConnection.HTTP_FORBIDDEN) {
            throw new NotAuthorizedException();
        } else if (responseCode == HttpURLConnection.HTTP_GONE) {
            throw new RateLimitExceededException();
        } else if (responseCode == HttpURLConnection.HTTP_INTERNAL_ERROR) {
            throw new ServerErrorException();
        }
    }
}
